package day0722;
public class Test5 {
    public static void main(String[] args) {
        Object a1=new Cat();

        if(a1 instanceof Animal){
            Animal a=(Animal)a1;
            a.eat();
        }else{
            Plants a=(Plants)a1;
            a.grow();
        }
    }
}



interface  Animal{
    public void eat();
}

class Cat implements  Animal{
    public void eat(){
        System.out.println("吃鱼");
    }
}





interface  Plants{
    public void grow();
}

class Flower implements  Plants{
    public void grow(){
        System.out.println("成长");
    }
}




